package com.usian.user.controller.v1;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.usian.common.dtos.PageResult;
import com.usian.common.dtos.ResponseResult;
import com.usian.model.user.dtos.AuthDto;
import com.usian.model.user.dtos.UserAuthDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.usian.user.service.IApUserAuthService;
import java.util.List;
import java.util.Map;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * APP实名认证信息表 前端控制器
 * </p>
 *
 * @author usian
 * @since 2022-09-29
 */
@RestController
@RequestMapping("/api/v1/auth")
@Api(tags = "APP实名认证信息表接口")
@CrossOrigin
public class ApUserAuthController{

    @Autowired
    private IApUserAuthService apUserAuthService;

    /**
     * 条件分页查询实名认证用户列表
     */
    @PostMapping("/list")
    public PageResult<UserAuthDto> findPage(@RequestBody AuthDto dto){
        return apUserAuthService.findPage(dto);
    }

    /**
     * 用户审核通过
     */
    @PostMapping("/authPass")
    public ResponseResult authPass(@RequestBody AuthDto dto){
        apUserAuthService.updateAuthStatus(dto,9);
        return ResponseResult.ok();
    }


    /**
     * 用户审核未通过
     */
    @PostMapping("/authFail")
    public ResponseResult authFail(@RequestBody AuthDto dto){
        apUserAuthService.updateAuthStatus(dto,2);
        return ResponseResult.ok();
    }
}
